package cn.domob.android.ads;

import android.content.Context;

public class D extends H
  implements p.a
{
  private static J e = new J(D.class.getSimpleName());
  private static final String i = "domobBridge";
  private int f = -1;
  private int g;
  private a h;

  protected D(Context paramContext, String paramString, int paramInt, b paramb)
  {
    super(paramContext, paramString, paramInt, paramb);
  }

  // ERROR //
  private String a(byte[] paramArrayOfByte, String paramString)
  {
    // Byte code:
    //   0: new 49	java/lang/StringBuilder
    //   3: dup
    //   4: invokespecial 51	java/lang/StringBuilder:<init>	()V
    //   7: aload_0
    //   8: invokevirtual 55	cn/domob/android/ads/D:getContext	()Landroid/content/Context;
    //   11: invokevirtual 61	android/content/Context:getFilesDir	()Ljava/io/File;
    //   14: invokevirtual 66	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   17: invokevirtual 70	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   20: getstatic 73	java/io/File:separator	Ljava/lang/String;
    //   23: invokevirtual 70	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   26: aload_2
    //   27: invokevirtual 70	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   30: invokevirtual 76	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   33: astore_3
    //   34: new 63	java/io/File
    //   37: dup
    //   38: aload_3
    //   39: invokespecial 77	java/io/File:<init>	(Ljava/lang/String;)V
    //   42: astore 4
    //   44: new 79	java/io/FileOutputStream
    //   47: dup
    //   48: aload 4
    //   50: invokespecial 82	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   53: astore 5
    //   55: aload 5
    //   57: aload_1
    //   58: invokevirtual 86	java/io/FileOutputStream:write	([B)V
    //   61: aload 5
    //   63: invokevirtual 89	java/io/FileOutputStream:close	()V
    //   66: aload_3
    //   67: areturn
    //   68: astore 11
    //   70: aconst_null
    //   71: areturn
    //   72: astore 10
    //   74: getstatic 33	cn/domob/android/ads/D:e	Lcn/domob/android/ads/J;
    //   77: aload 10
    //   79: invokevirtual 92	cn/domob/android/ads/J:a	(Ljava/lang/Throwable;)V
    //   82: aload_3
    //   83: areturn
    //   84: astore 8
    //   86: getstatic 33	cn/domob/android/ads/D:e	Lcn/domob/android/ads/J;
    //   89: aload 8
    //   91: invokevirtual 92	cn/domob/android/ads/J:a	(Ljava/lang/Throwable;)V
    //   94: aload 5
    //   96: invokevirtual 89	java/io/FileOutputStream:close	()V
    //   99: aconst_null
    //   100: areturn
    //   101: astore 9
    //   103: getstatic 33	cn/domob/android/ads/D:e	Lcn/domob/android/ads/J;
    //   106: aload 9
    //   108: invokevirtual 92	cn/domob/android/ads/J:a	(Ljava/lang/Throwable;)V
    //   111: goto -12 -> 99
    //   114: astore 6
    //   116: aload 5
    //   118: invokevirtual 89	java/io/FileOutputStream:close	()V
    //   121: aload 6
    //   123: athrow
    //   124: astore 7
    //   126: getstatic 33	cn/domob/android/ads/D:e	Lcn/domob/android/ads/J;
    //   129: aload 7
    //   131: invokevirtual 92	cn/domob/android/ads/J:a	(Ljava/lang/Throwable;)V
    //   134: goto -13 -> 121
    //
    // Exception table:
    //   from	to	target	type
    //   44	55	68	java/io/FileNotFoundException
    //   61	66	72	java/io/IOException
    //   55	61	84	java/io/IOException
    //   94	99	101	java/io/IOException
    //   55	61	114	finally
    //   86	94	114	finally
    //   116	121	124	java/io/IOException
  }

  protected String a(String paramString, String[] paramArrayOfString)
  {
    return super.a(F.b(getContext(), paramString), new String[] { "domob.js" });
  }

  public void a(p paramp)
  {
    if (paramp.f() != 200)
      return;
    String str = paramp.a();
    e.b("Download finish:" + str);
    new Thread(new Runnable(paramp, str)
    {
      public void run()
      {
        byte[] arrayOfByte = this.a.d();
        String str = D.a(D.this, arrayOfByte, this.a.a());
        if (str != null)
          D.c().b("Image saved:" + str);
        try
        {
          new g().b(D.this.getContext(), this.b, str);
          label75: D localD = D.this;
          Object[] arrayOfObject = new Object[3];
          arrayOfObject[0] = "domobBridge";
          arrayOfObject[1] = this.b;
          arrayOfObject[2] = str;
          localD.a(String.format("%s.assetReady('%s', '%s')", arrayOfObject));
          return;
        }
        catch (Exception localException)
        {
          D.c().a(localException);
          break label75:
          D.c().e("Error in saving image.");
        }
      }
    }).start();
  }

  protected void a(String paramString1, String paramString2, int paramInt, a parama)
  {
    this.f = paramInt;
    this.h = parama;
    loadDataWithBaseURL(paramString1, paramString2, "text/html", "UTF-8", null);
    if ((this.g != this.f) || (this.h == null))
      return;
    this.h.a(this);
  }

  protected void a(String paramString1, String paramString2, String paramString3)
  {
    try
    {
      g localg = new g();
      if (!localg.a(getContext(), paramString3, paramString2))
      {
        e.a(String.format("There is no pair in DB: %s : %s", new Object[] { paramString3, paramString2 }));
        localg.c(getContext(), paramString2, paramString3);
      }
      if (!localg.d(getContext(), paramString2))
        break label299;
      String str = localg.e(getContext(), paramString2);
      if (str != null)
      {
        e.b(String.format("Get image %s local location = %s from DB.", new Object[] { paramString2, str }));
        a(String.format("%s.assetReady('%s', '%s')", new Object[] { "domobBridge", paramString2, str }));
        this.g = (1 + this.g);
        if (this.g == this.f)
        {
          if (this.h == null)
            return;
          this.h.a(this);
          return;
        }
        J localJ = e;
        Object[] arrayOfObject = new Object[2];
        arrayOfObject[0] = Integer.valueOf(this.f);
        arrayOfObject[1] = Integer.valueOf(this.g);
        localJ.a(String.format("Total resources number=%d and replaced number=%d", arrayOfObject));
        return;
      }
    }
    catch (Exception localException)
    {
      e.a(localException);
      return;
    }
    e.a(String.format("Alias %s is in DB but the local location is not available. Need to download.", new Object[] { paramString2 }));
    while (true)
    {
      e.a(String.format("Alias %s is about to be downloaded.", new Object[] { paramString2 }));
      p localp = new p(getContext(), paramString1, this);
      localp.a(paramString2);
      localp.b();
      return;
      label299: e.b(String.format("Alias %s is not in DB. Download and insert.", new Object[] { paramString2 }));
    }
  }

  static abstract interface a
  {
    public abstract void a(H paramH);
  }
}

/* Location:           C:\Users\god\Desktop\liunianjishiben_V1.1_mumayi_3745b_dex2jar.jar
 * Qualified Name:     cn.domob.android.ads.D
 * JD-Core Version:    0.5.4
 */